'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	//event为客户端上传的参数
	let send_type=event.type
	let page=event.page
	let size=event.size
	let res
	for(let key in send_type){
		if(send_type[key]=="全部" ||send_type[key]==null ){
			delete send_type[key]
		}
	}
	if(JSON.stringify(send_type) == "{}"){
		res=await db.collection("movie_list").skip((page-1)*size).limit(size).get()
	}else{
		res=await db.collection("movie_list").where(send_type).get()
	}
	return res
};
